﻿using Dropit.Extension.Core;
using SocialPack.Composer.Extensions;

namespace SocialPack.Composer.modules.SocialPack.Composer.Functions.Linkedin
{
    public partial class ApplyWithLinkedin : BaseContentFunction
    {
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (ContentFunctionData.IsValue("APIKey"))
            {
                this.ApplyWithLinkedinControl.APIKey = ContentFunctionData.Property["APIKey"].ToString();
            }

            if (ContentFunctionData.IsValue("ThemeColor"))
            {
                this.ApplyWithLinkedinControl.ThemeColor = ContentFunctionData.Property["ThemeColor"].ToString();
            }

            if (ContentFunctionData.IsValue("JobLocation"))
            {
                this.ApplyWithLinkedinControl.JobLocation = ContentFunctionData.Property["JobLocation"].ToString();
            }

            if (ContentFunctionData.IsValue("JobTitle"))
            {
                this.ApplyWithLinkedinControl.JobTitle = ContentFunctionData.Property["JobTitle"].ToString();
            }

            if (ContentFunctionData.IsValue("RecipientEmail"))
            {
                this.ApplyWithLinkedinControl.RecipientEmail = ContentFunctionData.Property["RecipientEmail"].ToString();
            }

            if (ContentFunctionData.IsValue("CompanyId"))
            {
                this.ApplyWithLinkedinControl.CompanyId = ContentFunctionData.Property["CompanyId"].ToString();
            }

            if (ContentFunctionData.IsValue("CompanyLogo"))
            {
                this.ApplyWithLinkedinControl.CompanyLogo = ContentFunctionData.Property["CompanyLogo"].ToString();
            }

            if (ContentFunctionData.IsValue("IsPhoneRequired"))
            {
                this.ApplyWithLinkedinControl.IsPhoneRequired = (bool)ContentFunctionData.Property["IsPhoneRequired"].Value;
            }
        }
    }
}